package com.dowson.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @Author Zoe
 * @Date: 2020/11/24
 * @Description
 */
@Component
public class Boss implements ApplicationContextAware, BeanNameAware {
    //    @Autowired
    private Car car;

    //    @Autowired
    public Boss(Car car) {
        this.car = car;
    }

    public Car getCar() {
        return car;
    }

    //    @Autowired
    public void setCar(Car car) {
        this.car = car;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("IOC容器: " + applicationContext);
    }

    @Override
    public void setBeanName(String s) {
        System.out.println("bean名字: " + s);
    }
}
